package com.cx.core.magazine.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.cx.core.magazine.model.bean.form.UserForm;
import com.li.core.actionBase.ActionBase;

public class UserManageAction extends ActionBase {
	public ActionForward login(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		UserForm userForm = (UserForm) form;
		String username = userForm.getUsername();
		String password = userForm.getPassword();

		
		request.getSession().setAttribute("username", username);
		request.setAttribute("tip", "1");

		String PageForward = "mainindex";

		return mapping.findForward(PageForward);
	}

	public ActionForward logout(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		request.getSession().removeAttribute("username");
		String PageForward = "index";

		return mapping.findForward(PageForward);
	}
}
